<!--  -->
<template>
<div class='collect'>
   <Header><h2>收藏</h2></Header>
   <div class="collect-content">
       <ul class="collect-list">
           <li v-for="collectlist in collectlists" :key="collectlist.id">
               <div class="img-title"><img :src="collectlist.face" alt="">
               </div>
               <div class="list-cont">
                   <h2>{{collectlist.name}}</h2>
                   <p>{{collectlist.lastText}}</p>
               </div>
               <div class="toDetal">
                   <i class="iconfont icon-jiantou1" @click="toDetaiks(collectlist.id)"></i>
               </div>
           </li>
       </ul>
   </div>
</div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';
// import Vue from 'vue'
// var bus = new Vue();
    import  Header from '@/components/Header.vue'
export default {
//import引入的组件需要注入到components对象中才能使用
components: {Header},
data() {
//这里存放数据
return {

};
},
methods:{
    toDetaiks(id){
        this.$router.push(
            {
                path:"/details",
                query:{id:id}
                }
            );
    }
},

computed:{
    collectlists(){
      return  this.$store.state.collectlists
    }
},
mounted(){
    this.$store.dispatch("actCollectlists") 
}
}
</script>
<style lang="less">
    .collect-content{
        margin-top: 5rem;
        .collect-list{
            li{
                display: flex;
                justify-content: center;
                align-items: center;
                background: #fff;
                padding: 1rem;
                border-bottom: 1px solid #ccc;
                .img-title{
                    width: 5rem;
                    height: 5rem;
                    margin-right: 2rem;
                    border-radius: 5rem;
                    img{
                        width: 5rem;
                        height: 5rem;
                        border-radius: 5rem;
                    }
                }
                .list-cont{
                    width: 100%;
                    p{
                        margin-top: 1rem;
                        width: 20rem;
                        height: 1.6rem;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        white-space: nowrap;

                    }
                }
                .toDetal{
                    width: 7rem;
                    height: auto;
                    i{
                        font-size:4rem;
                        color: #666;
                    }
                }
            }
        }
    }
</style>